############################
##                       _oo0oo_
##                      o8888888o
##                      88" . "88
##                      (| -_- |)
##                      0\  =  /0
##                    ___/`---'\___
##                  .' \\|     |// '.
##                 / \\|||  :  |||// \
##                / _||||| -:- |||||- \
##               |   | \\\  - /// |   |
##               | \_|  ''\---/''  |_/ |
##               \  .-\__  '-'  ___/-. /
##             ___'. .'  /--.--\  `. .'___
##          ."" '<  `.___\_<|>_/___.' >' "".
##         | | :  `- \`.;`\ _ /`;.`/ - ` : | |
##         \  \ `_.   \_ __\ /__ _/   .-` /  /
##     =====`-.____`.___ \_____/___.-`___.-'=====
##                       `=---='
##
##
##     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
##
##           佛祖保佑     永不宕机     永无BUG
##
##LastEditors: PartyParrot(__init__)
##Date: 2022-06-12 19:35:36
##LastEditTime: 2022-06-12 19:36:57
##FilePath: EasyErrors.py
##Author: PartyParrot(__init__)
##Description: 
############################

# -*- coding:utf-8 -*-

class _Error:
    # 该类是所有 EasyPython 中错误的基本类，将会继承该类的所有方法。
    def __init__(self, pos_start, pos_end, error_name: str, details: str):
        """\
        pos_start: 错误（坐标）开始处
        pos_end: 错误（坐标）结束处
        error_name: 错误名称
        details: 详细信息
        """
        self.pos_start = pos_start
        self.pos_end = pos_end
        self.error_name = error_name
        self.details = details

    # 转换为字符串
    def as_string(self):
        result = f"{self.error_name}: {self.details}"
        result += f'\nFile {self.pos_start.file_name}, line {self.pos_start.line_number + 1}'
        return result

class IllegalCharError(_Error):
    def __init__(self, pos_start, pos_end, details):
        super().__init__(pos_start, pos_end, "IllegalCharError", details)